package cn.lcsjsxy.yxc.objectoriented.继承性;

public class Student extends Person {  //extends直接让Student继承Person的方法和变量。保留独有的
    //此时，Person是Student的副类
//    String name;
//    int age;
    String major;
    public Student(){}
    public Student(String name,int age,String major){
//        this.age=age;
        setAge(age);
        this.name=name;
        this.major=major;
    }
//    public void eat(){
//        System.out.println("吃饭");
//    }
//    public void sleep(){
//        System.out.println("睡觉");
//    }
    public void study(){
        System.out.println("学习");
    }

    public void show(){
        System.out.println("name:"+name+",age:"+getAge());
    }
}
